#include "dialog.h"
#include "ui_dialog.h"
#include <QFileInfo>

Dialog::Dialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Dialog)
{
    ui->setupUi(this);
}

Dialog::~Dialog()
{
    delete ui;
}

void Dialog::on_downloadButton_clicked()
{
    manager = new QNetworkAccessManager(this);
    url = ui->urlEdit->text();
    QFileInfo fileInfo(url.path());
    QString fileName = fileInfo.fileName();

    if (fileName.isEmpty())
        fileName = "index.html";

    if (QFile::exists(fileName)){

    }
}

void Dialog::on_urlEdit_returnPressed()
{
    on_downloadButton_clicked();
}

void Dialog::on_quitButton_clicked()
{
    this->close();
}
